Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Displaying Rendered • View rawDownload


android/README.md v4.5.0-rc.5 (eee4a4d7) Text, 9.61 KB

MeshChatX Android App

This directory contains the Android app build configuration using Chaquopy to embed the Python MeshChatX server.

Architecture

The app uses a WebView to display the existing Vue.js frontend. The Python server runs in the background via Chaquopy and serves the web interface on T383838https://127.0.0.1:8000.

Build debug APK

Prerequisites:

JDK 17 or newer (required by the Android Gradle Plugin used in this project). On distributions with multiple JDKs, point the build at JDK 17+ (for example T383838JAVA_HOME for the Gradle invocation).
Android SDK with API 34 platform and Build-Tools 34 installed. Set T383838ANDROID_HOME and T383838ANDROID_SDK_ROOT to the SDK root (the same directory for both is fine).
Host build tools for wheel patching: T383838patchelf, T383838cmake, T383838pkg-config, T383838unzip, and build essentials (T383838gcc, T383838make, headers). On Arch-based systems, install T383838patchelf cmake pkgconf base-devel rustup unzip.
T383838android/vendor/ must contain the Chaquopy vendor wheels (see Updating Android Python ABI Wheels). The build fails fast if this directory is missing or incomplete.
MeshChatX Python sources at the repository root (T383838meshchatx/). The build syncs them into the app before compiling.

SDK licenses:

• Use Command-line Tools T383838sdkmanager, not the legacy T383838tools/bin/sdkmanager from old SDK layouts. The legacy tool loads JAXB classes that were removed from the JDK in Java 11, so running it on JDK 17+ fails with T383838NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema.
• Install Command-line Tools if needed: download the package for your OS from Android Studio command-line tools, extract it so you have T383838cmdline-tools/latest/bin/sdkmanager under T383838ANDROID_HOME (the inner folder is often named T383838latest; see Google’s layout for that zip).
• Accept licenses (writes under the SDK; use sudo if the SDK is root-owned):

T282828
yes Tb4b4b4| path/to/cmdline-tools/latest/bin/sdkmanager --licenses


• Install missing packages if the build still complains (platform 34, build-tools 34, etc.):

T282828
path/to/cmdline-tools/latest/bin/sdkmanager Ta5d6ff"platforms;android-34" Ta5d6ff"build-tools;34.0.0"


Build from the T383838android/ directory (default slim flavor, universal ABI packaging):

T282828
./gradlew :app:assembleSlimDebug

Debug APK example path:

• T383838app/build/outputs/apk/slim/debug/app-slim-debug.apk

By default all ABIs are included in that single universal APK. To build only specific ABIs:

T282828
./gradlew :app:assembleSlimDebug -PmeshchatxAbisTff7b72=armeabi-v7a
./gradlew :app:assembleSlimDebug -PmeshchatxAbisTff7b72=arm64-v8a,x86_64


To emit per-ABI split APKs (and a universal split when Gradle enables it), set:

T282828
./gradlew :app:assembleSlimDebug -PmeshchatxAbiPackagingTff7b72=split


Same property accepts T383838MESHCHATX_ABI_PACKAGING.

Python bundle: T383838slim vs T383838full flavors

The Chaquopy layer packs T383838meshchatx/ into T383838assets/chaquopy/app.imy. These are Android product flavors (separate Gradle variants):

┌──────────────────────────┬───────────────────────────────────────────────────────────────────────┐
│ Flavor │ Meaning │
├──────────────────────────┼───────────────────────────────────────────────────────────────────────┤
T383838slim (default T383838isDefault) │ Smaller APK: sync omits Vue sources (T383838src/frontend), bundled Reticulu… │
T383838full │ Syncs the whole T383838meshchatx/ tree (Gradle runs T383838fetchRepositoryBundledW… │
└──────────────────────────┴───────────────────────────────────────────────────────────────────────┘

Assemble the matching variant:

T282828
./gradlew :app:assembleSlimDebug -PmeshchatxAbisTff7b72=arm64-v8a
./gradlew :app:assembleFullDebug
./gradlew :app:assembleFullRelease


Signing Release APKs (optional SourceStamp)

Build release APKs first:

T282828
./gradlew --no-daemon :app:assembleSlimRelease

Create a release signing key (one time):

T282828
mkdir -p android/keystore
keytool -genkeypair -v Tffea00\
-keystore android/keystore/meshchatx-release.jks Tffea00\
-alias meshchatx-release Tffea00\
-keyalg RSA Tffea00\
-keysize T79c0ff4096 Tffea00\
-validity T79c0ff9125


Optional: create a separate SourceStamp key (recommended if you use SourceStamp):

T282828
keytool -genkeypair -v Tffea00\
-keystore android/keystore/meshchatx-stamp.jks Tffea00\
-alias meshchatx-stamp Tffea00\
-keyalg RSA Tffea00\
-keysize T79c0ff4096 Tffea00\
-validity T79c0ff9125


Sign all T383838*-unsigned.apk release artifacts:

T282828
Te6edf3ANDROID_HOMETff7b72=Ta5d6ff"Te6edf3$HOMETa5d6ff/Android/sdkTa5d6ff" Tffea00\
Te6edf3SIGNING_KEYSTORE_PATHTff7b72=android/keystore/meshchatx-release.jks Tffea00\
Te6edf3SIGNING_KEY_ALIASTff7b72=meshchatx-release Tffea00\
Te6edf3SIGNING_KEYSTORE_PASSWORDTff7b72=Ta5d6ff'<release-keystore-password>' Tffea00\
Te6edf3SIGNING_KEY_PASSWORDTff7b72=Ta5d6ff'<release-key-password>' Tffea00\
bash scripts/sign-android-apks.sh


Sign with SourceStamp enabled:

T282828
Te6edf3ANDROID_HOMETff7b72=Ta5d6ff"Te6edf3$HOMETa5d6ff/Android/sdkTa5d6ff" Tffea00\
Te6edf3SIGNING_KEYSTORE_PATHTff7b72=android/keystore/meshchatx-release.jks Tffea00\
Te6edf3SIGNING_KEY_ALIASTff7b72=meshchatx-release Tffea00\
Te6edf3SIGNING_KEYSTORE_PASSWORDTff7b72=Ta5d6ff'<release-keystore-password>' Tffea00\
Te6edf3SIGNING_KEY_PASSWORDTff7b72=Ta5d6ff'<release-key-password>' Tffea00\
Te6edf3ENABLE_SOURCESTAMPTff7b72=Tffa657true Tffea00\
Te6edf3SOURCESTAMP_KEYSTORE_PATHTff7b72=android/keystore/meshchatx-stamp.jks Tffea00\
Te6edf3SOURCESTAMP_KEY_ALIASTff7b72=meshchatx-stamp Tffea00\
Te6edf3SOURCESTAMP_KEYSTORE_PASSWORDTff7b72=Ta5d6ff'<stamp-keystore-password>' Tffea00\
Te6edf3SOURCESTAMP_KEY_PASSWORDTff7b72=Ta5d6ff'<stamp-key-password>' Tffea00\
bash scripts/sign-android-apks.sh


The helper script auto-detects the newest Android Build-Tools, runs T383838zipalign, signs with T383838apksigner, and verifies each output certificate/signature block.

Updating Android Python ABI Wheels (Python 3.11)

Use this workflow when a dependency (for example T383838cryptography) requires custom Android wheels for the ABIs listed in T383838app/build.gradle (T383838ndk.abiFilters).

For T383838armeabi-v7a, Chaquopy usually has no prebuilt NumPy wheel; T383838scripts/build-android-wheels-local.sh builds NumPy from source and must cache the official T383838chaquopy-openblas wheel (handled in the script) and run with T383838ANDROID_HOME pointing at an SDK that includes Command-line Tools and NDK 27.3.13750724 (Chaquopy’s T383838target/android-env.sh installs the NDK via T383838sdkmanager if missing).

1. Build wheels in a Podman Python 3.11 container to avoid host Python mismatches:
• Use T383838docker.io/library/python:3.11-bookworm.
• Mount project root to T383838/work and Android SDK to T383838/opt/android-sdk.
• Export T383838ANDROID_HOME and T383838ANDROID_SDK_ROOT to T383838/opt/android-sdk.
• Example container entry:
T383838podman run --rm --network host -e ANDROID_HOME=/opt/android-sdk -e ANDROID_SDK_ROOT=/opt/android-sdk -v "/opt/android-sdk:/opt/android-sdk" -v "<repo>:/work" -w /work docker.io/library/python:3.11-bookworm bash
2. Keep custom Chaquopy recipes in T383838android/chaquopy-recipes/<package>-<major>/:
• Define package/version in T383838meta.yaml.
• Store source patches in T383838patches/.
3. Build the configured ABIs with Chaquopy T383838build-wheel.py (via T383838scripts/build-android-wheels-local.sh) and place final wheels in T383838android/vendor/.
4. Update T383838android/app/build.gradle T383838pip installs to the new pinned version.
5. Rebuild with T383838./gradlew :app:assembleSlimDebug (or T383838-PmeshchatxAbiPackaging=split when you need per-ABI artifacts) and confirm the expected APK under T383838app/build/outputs/apk/.

Local host build example (no shell startup files required):

T282828
Tffa657cd /path/to/reticulum-meshchatX
Te6edf3ANDROID_HOMETff7b72=Ta5d6ff"Te6edf3$HOMETa5d6ff/Android/sdkTa5d6ff" Tffea00\
Te6edf3ANDROID_SDK_ROOTTff7b72=Ta5d6ff"Te6edf3$HOMETa5d6ff/Android/sdkTa5d6ff" Tffea00\
Te6edf3PYTHON_BINTff7b72=Ta5d6ff"Tff7b72$(uv python find T79c0ff3.11Tff7b72)Ta5d6ff" Tffea00\
bash scripts/build-android-wheels-local.sh --abis armeabi-v7a


If T383838uv does not have Python 3.11 yet, install it first:

T282828
uv python install T79c0ff3.11


If the wheel build fails with T383838No such file or directory: 'patchelf', install T383838patchelf and re-run the same command.

Notes:
• For Rust-backed wheels (such as modern T383838cryptography), build inside the container with Rust toolchain available.
• Keep recipe files and patches versioned; keep generated build artifacts untracked.

Custom Recipes and Patches

This project keeps Android-specific Chaquopy recipes in T383838android/chaquopy-recipes/ to bridge gaps between desktop Python dependencies and Android wheel availability.

• T383838cryptography-46
• Purpose: provide Android ABI wheels for T383838cryptography 46.0.7 for each ABI in the wheel script (for example T383838arm64-v8a, T383838x86_64, T383838armeabi-v7a) because upstream Chaquopy index only provided older builds.
• T383838patches/openssl_no_legacy.patch: disables OpenSSL legacy provider loading, which is unavailable in the bundled Android OpenSSL runtime.
• T383838patches/pyo3_no_interpreter.patch: enables compatible T383838pyo3 ABI settings for Chaquopy Python 3.11 Android builds.

• T383838aiohttp-3.13
• Purpose: align Android with desktop dependency line (T383838aiohttp 3.13.3) by building fresh ABI wheels with Chaquopy.
• No source patch is required; recipe pins the newer upstream version for Android wheel generation.

• T383838psutil-7.2
• Purpose: align Android with desktop dependency line (T383838psutil 7.2.2) while preserving Android runtime behavior.
• T383838patches/chaquopy.patch: treats T383838android platform as Linux in psutil internals and forces a safe partition enumeration path because T383838/proc/filesystems can be restricted by SELinux on some Android API levels.

• T383838bcrypt-5
• Purpose: tracks attempted upgrade path to desktop-equivalent bcrypt.
• Status: currently not enabled in Android app dependencies; T383838bcrypt==3.1.7 remains pinned for stable APK builds.

License

This directory is part of the main project licensing split:
• project-owned portions: 0BSD
• original upstream MeshChat portions: MIT

See ../LICENSE for full text and notices.


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────